class Solution {
    public int minimumSize(int[] nums, int maxOperations) {
        int left = 1;
        int right = Arrays.stream(nums).max().getAsInt();
        while (left < right)
        {
            int mid = left + right >> 1;
            if (check(nums, mid) > maxOperations)
            {
                left = mid + 1;
            }
            else
                right = mid;
        }
        return right;
    }
    public int check(int[] nums, int mid)
    {
        int count = 0;
        for (int x : nums)
        {
            count += (x - 1) / mid;
        }
        return count;
    }
}